<?php
namespace App\Logic\Plat\Shopify;
use Slince\Shopify\PrivateAppCredential;
use Slince\Shopify\Client;
class GrabCommon
{

    public static $_shop = ['UNG','ORG'];

    public static function getRequestClient($shop){
        $access = self::getAccess($shop);
        $credential = new PrivateAppCredential(
            $access['API_KEY'],
            $access['PASSWORD'],
            $access['SHARED_SECRET']
        );
        $client = new Client($access['SHOP_NAME'], $credential,  [
            'meta_cache_dir' => './tmp', // Metadata cache dir, required
        ]);
        return $client;
    }

    private static function getAccess($shop){
        return self::$_access[$shop];
    }

    private static $_access = [
        'UNG' => [
            'API_KEY' => '9a0008b13de4d09c9c39ca83074b4343',
            'SHARED_SECRET' => '68c87f0c6e159fb7b37a897b930e6b12',
            'SHOP_NAME' => 'unigearstyle.myshopify.com',
            'PASSWORD' => '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',
        ],
        //'ORG' => [
        //    'API_KEY' => '7cda50fab1b9051ecc65af2cbf1b78a9',
        //    'SHARED_SECRET' => 'ea582721707b9ef676849fbc518227c7',
        //    'SHOP_NAME' => 'origemstyle.myshopify.com',
        //    'PASSWORD' => 'c1baf44ffc3c4f8061c5e7874ddc4272',
        //]
    ];
}
